//
//  Adaption.h
//  MYSFTeacher
//
//  Created by zhengbing on 2016/11/1.
//  Copyright © 2016年 zhengbing. All rights reserved.
//

#ifndef Adaption_h
#define Adaption_h

#import <UIKit/UIKit.h>

#pragma 尺寸

#define kwidth [UIScreen mainScreen].bounds.size.width
#define kheight [UIScreen mainScreen].bounds.size.height

#pragma 参照尺寸

#define kBaseWidth 750
#define kBaseHeight 1334

#define Inline static inline

//适配比率
Inline CGFloat AAdaptationWidth() {
    return kwidth/kBaseWidth;
}

//尺寸适配
Inline CGFloat AAdaptation(CGFloat x) {
    return x * AAdaptationWidth();
}

Inline CGSize AAdaptationSize(CGFloat width, CGFloat height) {
    CGFloat newWidth = width * AAdaptationWidth();
    CGFloat newHeight = height * AAdaptationWidth();
    return CGSizeMake(newWidth, newHeight);
}

Inline CGPoint AAadaptationPoint(CGFloat x, CGFloat y) {
    CGFloat newX = x * AAdaptationWidth();
    CGFloat newY = y * AAdaptationWidth();
    return  CGPointMake(newX, newY);
}

Inline CGRect AAdaptionRect(CGFloat x, CGFloat y, CGFloat width, CGFloat height){
    CGFloat newX = x*AAdaptationWidth();
    CGFloat newY = y*AAdaptationWidth();
    CGFloat newW = width*AAdaptationWidth();
    CGFloat newH = height*AAdaptationWidth();
    return CGRectMake(newX, newY, newW, newH);
}

//字体适配
Inline UIFont * AAFont(CGFloat font){
    return [UIFont systemFontOfSize:font*AAdaptationWidth()];
}

#endif /* Adaption_h */
